package com.happy.cat.project.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.happy.cat.common.utils.BeanTools;
import com.happy.cat.framework.aspectj.lang.annotation.Excel;
import com.happy.cat.project.system.domain.vo.UserInfoItemVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 用户注册的账号对象 user_account
 *
 * @author verne
 * @date 2020-08-04
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName(autoResultMap = true )
@ApiModel(value="用户注册的账号对象", description="用户注册的账号对象数据")
public class UserAccount implements Serializable{

    private static final long serialVersionUID=1L;

    /** id */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value="id")
    private Long id;

    /** 账号名 */
    @Excel(name = "账号名")
    @ApiModelProperty(value = "账号名")
    private String accountName;

    /** 用户id */
    @Excel(name = "用户id")
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /** 账号密码 */
    @Excel(name = "账号密码")
    @ApiModelProperty(value = "账号密码")
    private String password;

    /** 创建时间 */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 状态 */
    @Excel(name = "状态")
    @ApiModelProperty(value = "状态")
    private Integer status;

    /** 昵称 */
    @Excel(name = "昵称")
    @ApiModelProperty(value = "昵称")
    private String nick;

    /** 标签 */
    @Excel(name = "标签")
    @ApiModelProperty(value = "标签")
    private String title;

    /** 性别 */
    @Excel(name = "性别")
    @ApiModelProperty(value = "性别")
    private Integer sex;

    /** 猫粮余额 */
    @ApiModelProperty(value = "猫粮余额")
    private Double balance;

    /** 猫粮余额 */
    @ApiModelProperty(value = "猫币余额")
    private Double catCoinBalance;

    /** 宠爱值余额 */
    @ApiModelProperty(value = "宠爱值余额")
    private Double petValueBalance;

    /** 荧光棒 */
    @Excel(name = "荧光棒")
    @ApiModelProperty(value = "荧光棒")
    private Long lightStick;

    /** 归属渠道 */
    @Excel(name = "归属渠道")
    @ApiModelProperty(value = "归属渠道")
    private String channel;

    /** 注册设备及设备号 */
    @Excel(name = "注册设备及设备号")
    @ApiModelProperty(value = "注册设备及设备号")
    private String device;

    /** 个性签名 */
    @Excel(name = "个性签名")
    @ApiModelProperty(value = "个性签名")
    private String signature;

    /** 用户标签 */
    @Excel(name = "用户标签")
    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty(value = "用户标签")
    private List<String> labelList = new ArrayList<>();

    /** 相册 */
    @Excel(name = "相册")
    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty(value = "相册")
    private List<String> albumList = new ArrayList<>();

    /** 地区 */
    @Excel(name = "地区")
    @ApiModelProperty(value = "地区")
    private String area;

    /** 等级 */
    @Excel(name = "等级")
    @ApiModelProperty(value = "等级")
    private String userLevel;

    /** 头像 */
    @Excel(name = "头像")
    @ApiModelProperty(value = "头像")
    private String avatar;

    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remarks;

    /** 是否在线 */
    @Excel(name = "是否在线")
    @ApiModelProperty(value = "是否在线")
    private Integer isOnline;

    /** 猫号 */
    @Excel(name = "猫号")
    @ApiModelProperty(value = "猫号")
    private Long catCode;

    /** 年龄 */
    @Excel(name = "年龄")
    @ApiModelProperty(value = "年龄")
    private Integer age;

    /** 渠道ID */
    @Excel(name = "渠道ID")
    @ApiModelProperty(value = "渠道ID")
    private Long channelId;

    /** 生日 */
    @Excel(name = "生日" , width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "生日")
    private Date birthDay;

    /** 手机号 */
    @Excel(name = "手机号")
    @ApiModelProperty(value = "手机号")
    private String phone;

    /** 手机号 */
    @Excel(name = "经验值")
    @ApiModelProperty(value = "经验值")
    private Integer exp;

    @ApiModelProperty(value = "交互权限信息")
    @TableField(exist = false)
    private UserImAuthority userImAuthority;

    @ApiModelProperty(value="新密码")
    @TableField(exist = false)
    private String newPassword;

    public UserInfoItemVo convertToItemVo(){
        return BeanTools.convert(this, new UserInfoItemVo());
    }

}


